package captcha

import (
	"image/color"
)

var cap *Captcha

func init() {
	cap = New()
	// 设置字体
	cap.SetFont("captcha.ttf")
	cap.SetSize(128, 64)
	cap.SetDisturbance(MEDIUM)
	cap.SetFrontColor(color.RGBA{255, 255, 255, 255})
	cap.SetBkgColor(color.RGBA{255, 0, 0, 255}, color.RGBA{0, 0, 255, 255}, color.RGBA{0, 153, 0, 255})

}

func GetCaptcha(args ...int) (*Image, string) {
	l := 4
	t := NUM
	if len(args) > 0 {
		l = args[0]
	}
	if len(args) > 1 {
		t = StrType(args[1])
	}
	return cap.Create(l, t)
}
